(deftemplate currentState
	(slot name (default none))
	(slot state (default middle))
	(slot text)		
	(slot answerType (default radioButton))
	(slot selected)
	(multislot answers)
)

(deftemplate result
	(slot name (type STRING))
	(slot value (type STRING))
	(slot secure (type STRING))
)

; Start
(defrule system-banner ""
	=>
	(assert	(currentState 
		(name start)
		(state initial)
		(text START_TEXT)
		(answers))
	)
)

; Results window
(defrule EndOfQuestions ""
	?state<-(currentState)
	(end)
	=>
	(retract ?state) 
	(assert (currentState 
		(text FINAL_TEXT)
		(state final)
	))
)


; Shoes question
(defrule haveShoes ""
	?state<-(currentState)
	(not(shoesQuestion))
	=>
	(retract ?state) 
	(assert (shoesQuestion))	
	(assert (currentState
		(text SHOES_QUESTION)
		(name shoes)
		(answers YES NO)
		(selected YES)	
	))
)

; Secure question
(defrule withSecure ""
	?state<-(currentState)
	(not(secureQuestion))
	=>
	(retract ?state) 
	(assert (secureQuestion))	
	(assert (currentState
		(text SECURE_QUESTION)
		(name secure)
		(answers YES NO DONT_CARE)
		(selected YES)	
	))
)

; Panel question
(defrule whatPanel ""
	?state<-(currentState)
	(not(panelQuestion))
	=>
	(retract ?state) 
	(assert (panelQuestion))	
	(assert (currentState
		(text PANEL_QUESTION)
		(name panel)
		(answers NONE IV V VI VI.1 VI.2 VI.3 VI.4 VI.5_UP)
		(selected NONE)	
	))
)

; Assurance question
(defrule withAssurance ""
	?state<-(currentState)
	(not(assuranceQuestion))
	=>
	(retract ?state) 
	(assert (assuranceQuestion))	
	(assert (currentState
		(text ASSURANCE_QUESTION)
		(name asecuration)
		(answers YES NO)
		(selected YES)	
	))
)

; How long do you climb question
(defrule timeClimb ""
	?state<-(currentState)
	(not(timeQuestion))
	=>
	(retract ?state) 
	(assert (timeQuestion))	
	(assert (currentState
		(text TIME_QUESTION)
		(name long)
		(answers NONE 1 2 2_UP)
		(selected NONE)	
	))
)

; Practice question
(defrule practiceFrequency ""
	?state<-(currentState)
	(not(practiceQuestion))
	=>
	(retract ?state) 
	(assert (practiceQuestion))	
	(assert (currentState
		(text PRACTICE_QUESTION)
		(name training)
		(answers NONE 1 2 2_UP)
		(selected NONE)	
	))
)

; Rope question
(defrule ropeLength ""
	?state<-(currentState)
	(not(ropeQuestion))
	=>
	(retract ?state) 
	(assert (ropeQuestion))	
	(assert (currentState
		(text ROPE_QUESTION)
		(name rope)
		(answers 50 60 70 NONE)
		(selected NONE)	
	))
)

; Express question
(defrule expressCount ""
	?state<-(currentState)
	(not(expressQuestion))
	=>
	(retract ?state) 
	(assert (expressQuestion))	
	(assert (currentState
		(text EXPRESS_QUESTION)
		(name express)
		(answers NONE 6_LESS 610 1015 15_UP)
		(selected NONE)	
	))
)

; Friend question
(defrule haveFriend ""
	?state<-(currentState)
	(not(friendQuestion))
	=>
	(retract ?state) 
	(assert (friendQuestion))	
	(assert (currentState
		(text FRIEND_QUESTION)
		(name friend)
		(answers NONE 6_LESS 610 1015 15_UP)
		(selected NONE)	
	))
)

; Place question
(defrule placeTraffic ""
	?state<-(currentState)
	(not(trafficQuestion))
	=>
	(retract ?state) 
	(assert (trafficQuestion))	
	(assert (currentState
		(text TRAFFIC_QUESTION)
		(name place)
		(answers CALM CROWDED DONT_CARE)
		(selected DONT_CARE)	
	))
	(assert (end))
)